package cn.kaguyaever.service.impl;

import cn.kaguyaever.dao.CandidateDao;
import cn.kaguyaever.dao.VoteDao;
import cn.kaguyaever.dao.impl.CandidateDaoImpl;
import cn.kaguyaever.dao.impl.VoteDaoImpl;
import cn.kaguyaever.entity.Candidate;
import cn.kaguyaever.entity.Vote;
import cn.kaguyaever.service.VoteService;

import java.util.List;

public class VoteServiceImpl implements VoteService {

    private VoteDao voteDao = new VoteDaoImpl();

    public void createVote(Vote vote) {

        voteDao.createVote(vote);

    }

    public Vote queryVote(String voteId){

        return voteDao.queryVoteByVoteId(voteId);
    }

    public List<Vote> queryAllVote(String projectId){
        return voteDao.queryAllVoteByProjectId(projectId);
    }

    public void beginVote(String voteId){
        voteDao.beginVote(voteId);
    }

    public void endVote(String voteId){voteDao.endVote(voteId);}

    public void setWinner(String winner,String voteId){
        voteDao.setWinner(winner,voteId);
    }

    public void deleteVote(String projectId){voteDao.deleteVote(projectId);}
}
